home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / dwreshtd / drsdw.exe / DRSD.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-07-22  |  6.8 KB  |  231 lines

  1. VERSION 5.00
  2. Object = "{BDBA7F3D-D7B4-11D1-A28B-00C04FA30E7F}#1.0#0"; "DRSD.dll"
  3. Begin VB.Form Form1 
  4.    Caption         =   "DameWare Remote Shut Down Sample"
  5.    ClientHeight    =   5400
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   6255
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   5400
  11.    ScaleWidth      =   6255
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.CommandButton Command3 
  14.       Caption         =   "EXIT"
  15.       Height          =   375
  16.       Left            =   4560
  17.       TabIndex        =   10
  18.       Top             =   4920
  19.       Width           =   1455
  20.    End
  21.    Begin VB.CommandButton Command2 
  22.       Caption         =   "Abort"
  23.       Height          =   375
  24.       Left            =   4560
  25.       TabIndex        =   9
  26.       Top             =   4320
  27.       Width           =   1455
  28.    End
  29.    Begin VB.TextBox Text5 
  30.       Height          =   375
  31.       IMEMode         =   3  'DISABLE
  32.       Left            =   3720
  33.       PasswordChar    =   "*"
  34.       TabIndex        =   2
  35.       Top             =   1320
  36.       Width           =   2415
  37.    End
  38.    Begin VB.TextBox Text4 
  39.       Height          =   375
  40.       Left            =   3720
  41.       TabIndex        =   1
  42.       Top             =   600
  43.       Width           =   2415
  44.    End
  45.    Begin VB.TextBox Text3 
  46.       Height          =   1335
  47.       Left            =   240
  48.       MultiLine       =   -1  'True
  49.       TabIndex        =   7
  50.       Top             =   3960
  51.       Width           =   4095
  52.    End
  53.    Begin VB.TextBox Text2 
  54.       Height          =   375
  55.       Left            =   360
  56.       TabIndex        =   6
  57.       Top             =   3000
  58.       Width           =   975
  59.    End
  60.    Begin VB.CheckBox Check3 
  61.       Caption         =   "Use Control Dialog"
  62.       Height          =   255
  63.       Left            =   360
  64.       TabIndex        =   5
  65.       Top             =   2160
  66.       Width           =   2775
  67.    End
  68.    Begin VB.CheckBox Check2 
  69.       Caption         =   "&Kill Applications Without Saving Data"
  70.       Height          =   255
  71.       Left            =   360
  72.       TabIndex        =   4
  73.       Top             =   1800
  74.       Width           =   3135
  75.    End
  76.    Begin VB.CheckBox Check1 
  77.       Caption         =   "Reboot After Shutdown"
  78.       Height          =   255
  79.       Left            =   360
  80.       TabIndex        =   3
  81.       Top             =   1440
  82.       Width           =   2175
  83.    End
  84.    Begin VB.TextBox Text1 
  85.       Height          =   375
  86.       Left            =   360
  87.       TabIndex        =   0
  88.       Top             =   600
  89.       Width           =   1815
  90.    End
  91.    Begin VB.CommandButton Command1 
  92.       Caption         =   "ShutDown"
  93.       Default         =   -1  'True
  94.       Height          =   375
  95.       Left            =   4560
  96.       TabIndex        =   8
  97.       Top             =   3720
  98.       Width           =   1455
  99.    End
  100.    Begin DRSDLibCtl.DRSDCtl DRSDCtl1 
  101.       Height          =   480
  102.       Left            =   2760
  103.       TabIndex        =   11
  104.       Top             =   0
  105.       Width           =   480
  106.       Machine         =   ""
  107.       UserID          =   ""
  108.       Password        =   ""
  109.       ShutDownMessage =   "Your computer is being shut down.  Save any work that may be lost!"
  110.       ShutDownDelay   =   30
  111.       ShutDownForceAppsClosed=   0
  112.       RebootAfterShutdown=   1
  113.       ShutDownUseDialog=   0
  114.    End
  115.    Begin VB.Label Label5 
  116.       Caption         =   "Password"
  117.       Height          =   255
  118.       Left            =   3720
  119.       TabIndex        =   16
  120.       Top             =   1080
  121.       Width           =   2415
  122.    End
  123.    Begin VB.Label Label4 
  124.       Caption         =   "UserID"
  125.       Height          =   255
  126.       Left            =   3720
  127.       TabIndex        =   15
  128.       Top             =   360
  129.       Width           =   2175
  130.    End
  131.    Begin VB.Label Label3 
  132.       Caption         =   "Enter message to display in the shutdown dialog box."
  133.       Height          =   255
  134.       Left            =   240
  135.       TabIndex        =   14
  136.       Top             =   3720
  137.       Width           =   3975
  138.    End
  139.    Begin VB.Label Label2 
  140.       Caption         =   "Delay in seconds"
  141.       Height          =   255
  142.       Left            =   360
  143.       TabIndex        =   13
  144.       Top             =   2760
  145.       Width           =   1215
  146.    End
  147.    Begin VB.Label Label1 
  148.       Caption         =   "Machine Name"
  149.       Height          =   255
  150.       Left            =   360
  151.       TabIndex        =   12
  152.       Top             =   360
  153.       Width           =   1815
  154.    End
  155. Attribute VB_Name = "Form1"
  156. Attribute VB_GlobalNameSpace = False
  157. Attribute VB_Creatable = False
  158. Attribute VB_PredeclaredId = True
  159. Attribute VB_Exposed = False
  160. Private Sub Command1_Click()
  161. On Error GoTo ErrorHandler
  162.     Dim ConnectFlag
  163.     ConnectFlag = False
  164.     DRSDCtl1.Machine = Text1.Text
  165.     DRSDCtl1.RebootAfterShutdown = Check1.Value
  166.     DRSDCtl1.ShutDownForceAppsClosed = Check2.Value
  167.     If DRSDCtl1.Machine <> DRSDCtl1.GetLocalMachineName Then
  168.         ConnectFlag = True
  169.         DRSDCtl1.UserID = Text4.Text
  170.         DRSDCtl1.Password = Text5.Text
  171.         DRSDCtl1.UserConnect
  172.     End If
  173.     If Check3.Value = 1 Then
  174.         DRSDCtl1.ShutDownUseDialog = True
  175.     Else
  176.         DRSDCtl1.ShutDownUseDialog = False
  177.     End If
  178.     DRSDCtl1.ShutDownMessage = Text3.Text
  179.     DRSDCtl1.ShutDownDelay = Text2.Text
  180.     If DRSDCtl1.ShutDown <> 0 Then
  181.         s = "The machine [ " + DRSDCtl1.Machine + " ] has accepted the Shutdown request."
  182.         MsgBox s, vbInformation, "Information"
  183.     End If
  184.     If ConnectFlag = True Then
  185.         DRSDCtl1.UserDisconnect
  186.     End If
  187. Exit Sub
  188. ErrorHandler:
  189.     OnErrorHandler
  190.     'Resume Next
  191. End Sub
  192. Private Sub Command2_Click()
  193. On Error GoTo ErrorHandler
  194. Dim ConnectFlag
  195. ConnectFlag = False
  196. DRSDCtl1.Machine = Text1.Text
  197. If DRSDCtl1.Machine <> DRSDCtl1.GetLocalMachineName Then
  198.     ConnectFlag = True
  199.     DRSDCtl1.UserID = Text4.Text
  200.     DRSDCtl1.Password = Text5.Text
  201.     DRSDCtl1.UserConnect
  202. End If
  203. If DRSDCtl1.ShutDownAbort <> 0 Then
  204.     s = "The machine [ " + DRSDCtl1.Machine + " ] has accepted the request to Abort."
  205.     MsgBox s, vbInformation, "Information"
  206. End If
  207. If ConnectFlag = True Then
  208.     DRSDCtl1.UserDisconnect
  209. End If
  210. Exit Sub
  211. ErrorHandler:
  212.     OnErrorHandler
  213.     'Resume Next
  214. End Sub
  215. Private Sub Command3_Click()
  216.     End
  217. End Sub
  218. Private Sub Form_Load()
  219. Text1.Text = DRSDCtl1.GetLocalMachineName
  220. Text4.Text = DRSDCtl1.GetCurrentUserID
  221. Check1.Value = 1
  222. Check2.Value = 0
  223. Text2.Text = DRSDCtl1.ShutDownDelay
  224. Text3.Text = "Your computer is being shut down.  Save any work that may be lost!"
  225. End Sub
  226. Sub OnErrorHandler()
  227. If Err.Number <> 0 Then
  228.     MsgBox Err.Description, , "Error"
  229. End If
  230. End Sub
  231.